/**
 * Copyright (C), 2024, Y2 T205
 * FileName: ch01_04
 * Author: Lenovo
 * Date: 2024-01-15 15:16
 * Description:
 * History:
 * <author> <time> <version> <desc>
 * 作者姓名 修改时间 版本号 描述
 */


package com.example.multithreading;


import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author Lenovo
 * @create 2024-01-15
 * @since 1.0.0
 */

/**
 * 模板设计模式 父类编写算法结构代码 ,子类实现逻辑细节
 */
@SpringBootTest
public class ch01_04 {

    public final void print(String message){
        System.out.println("###########");
        innerPrint(message);
        System.out.println("###########");
    }

    protected void innerPrint(String message) {

    }

    @Test
    public void test (){
        ch01_04 obj1=new ch01_04(){
            @Override
            public void innerPrint(String message){
                System.out.println("+"+message+"+");
            }
        };
        obj1.print("nihao1");

        ch01_04 obj2 =new ch01_04(){
            @Override
            protected void innerPrint(String message) {
                System.out.println("$"+message+"$");
            }
        };
        obj2.print("nihao2");

    }


}
